<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style outline-style2">
    <div class="Showroom-parent" v-if="props.info.digitalShowroom">
      <digitalShowroomInfo :url="props.info.digitalShowroom" :id="props.info.id" />
    </div>
    <img class="outline-parent-bg" :src="publicUrls + 'free/style8/Level1outlineStyle1Bg.webp'" alt="" />
    <div
      class="outline jy-style-height"
      :style="!props.info.subTitle && !props.info.value && !props.info.remarks && { paddingBottom: 0 }"
      :class="route.meta.loopType && 'outline-loop'"
    >
      <div
        class="content-tiitle"
        v-html="textType(props.info.text)"
        v-if="props.info.subTitle || props.info.value || props.info.remarks"
      ></div>
      <div class="content-tiitle2" v-else>
        {{ props.info.text }}
      </div>

      <div
        class="outline-content"
        :class="!props.info.value && !props.info.subTitle && 'outline-content-end'"
        v-if="props.info.subTitle || props.info.value || props.info.remarks"
      >
        <p class="outline-subTitle" :class="!props.info.value && 'subTitle'" v-if="props.info.subTitle">
          {{ props.info.subTitle }}
        </p>
        <div class="cover" v-if="props.info.value">
          <img
            class="outline-cover"
            @click="ImgVisible = true"
            :src="urls + props.info.value + '?imageView2/3/format/webp'"
            alt=""
          />
        </div>
        <TextMax
          :data="props.info.remarks"
          :infoData="props.info"
          :title="props.info.text"
          :row="props.info.value && props.info.subTitle ? 4 : !props.info.subTitle && props.info.value ? 5 : 7"
        ></TextMax>
      </div>
    </div>
    <img class="shadow" :src="publicUrls + 'free/style8/firstLevelOutline1Shadow.png?imageView2/3/format/webp'" alt="" />
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'free8Style1',
});
</script>

<script setup lang="ts">
import { publicUrls, textType } from '@/utils/minxin';
import { getTextHtml } from '@/utils/minxin';
import digitalShowroomInfo from '@/freeComponents/unitdigitalShowroom/style8.vue';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { useProjectStore } from '@/store';
import { transform } from 'lodash';
import { useRoute } from 'vue-router';

const ImgVisible = ref(false);
const store = useProjectStore();
const route = useRoute();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style scoped lang="less">
.outline-parent {
  position: relative;
  margin-right: 90px;
  margin-top: 0;
  margin-left: 120px;
  .Showroom-parent {
    position: absolute;
    top: 22px;
    right: 59px;
    z-index: 23;
  }
  .shadow {
    width: 776px;
    height: 248px;
    position: absolute;
    bottom: -30px;
    left: -55px;
  }
}
.outline-parent-bg {
  width: 528px;
  height: 100%;
  position: relative;
  z-index: 20;
}
.outline-loop {
  padding: 102px 134px 92px 124px !important;
  .content-tiitle2 {
    margin-bottom: 4px !important;
  }
}
.outline {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  padding: 96px 134px 92px 124px;
}
.content-tiitle {
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url(https://static.jiyi.show/free/style8/Level1titlebg.png) no-repeat center/100% 100%;
  padding: 20px;
  ::v-deep p {
    height: 100%;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 4px;
    color: #4f6e5c;
    text-align: end;
    font-family: 'SourceHanSerifCN-Bold';
    font-size: 32px;
    line-height: 36px;
    margin-top: 12px;
    &:nth-child(2) {
      margin-left: 12px;
    }
  }
}
.content-tiitle2 {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 4px;
  color: #4f6e5c;
  text-align: center;
  font-family: 'SourceHanSerifCN-Bold';
  font-size: 32px;
  line-height: 36px;
  padding: 20px;
  padding-top: 32px;
  position: relative;
  background: url(https://static.jiyi.show/free/style8/Level1titlebg2.png) no-repeat center/100% 100%;
  margin-bottom: 7px;
}
.outline-content-end {
  padding-top: 45px;
}
.outline-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-top: 24px;
  overflow: hidden;
  .subTitle {
    margin-bottom: 40px !important;
  }
  .outline-subTitle {
    height: 48px;
    color: #4f6e5c;
    text-align: center;
    font-family: 'SourceHanSerifCN';
    font-size: 18px;
    line-height: 24px;
    margin-bottom: 24px;
    opacity: 0.5;
  }
  .cover {
    display: flex;
    align-items: center;
    width: 100%;
    max-height: 152px;
    flex: 1;
    overflow: hidden;
    margin-bottom: 16px;
    background: #746d63;
    &:hover img {
      transform: scale(1.2);
    }
    img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      transition: all 0.3s ease;
    }
  }
}

::v-deep .textMore-box {
  flex-shrink: 0;
}
::v-deep .van-text-ellipsis {
  font-family: PingFangSC !important;
  font-size: 16px !important;
  color: rgba(0, 0, 0, 0.59) !important;
  line-height: 32px !important;
}
::v-deep .van-text-ellipsis__action::before {
  color: #345746 !important;
  font-weight: 400 !important;
  text-decoration-line: underline;
}
</style>